#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date    : 2020-08-27 15:33:19
# @Author  : Zuo Zhongfei (zuozhongfei@126.com)
# @Link    : www
# @Version : $Id$

"""计算字符串中字符出现的次数"""
import os

filename = '../../file/chapter_10/alice.txt'

try:
    with open(filename) as file_object:
        contnets = file_object.read()
except Exception as e:
    print("文件不存在")
else:
    # print(contnets)
    # 计算 you 单词出现的次数
    print("you 这个单词出现的次数为：" + str(contnets.count('you')))
    print("you 这个单词不区分大小写出现的次数为：" + str(contnets.lower().count('you')))
